﻿<Page 
    x:Class="PerspectiveDemo.Wpf3D.View.Matrix3DDemo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:p="http://www.codeplex.com/perspective"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    mc:Ignorable="d" 
    d:DesignHeight="300" d:DesignWidth="300"
    Style="{StaticResource PageStyle}"
    Loaded="Page_Loaded"
	Title="Matrix3DDemo">
    <Page.Resources>
        <sys:Int32 x:Key="RingSegmentCount">80</sys:Int32>
        <sys:Int32 x:Key="RingSideCount">18</sys:Int32>
        <sys:Double x:Key="RingRadius">100</sys:Double>
        <ScaleTransform3D x:Key="RingScaleTransform" ScaleX="0.01" ScaleY="0.01" ScaleZ="0.01" />
        <ScaleTransform3D x:Key="ConicalScaleTransform" ScaleX="0.03" ScaleY="0.03" ScaleZ="0.1" />
        <DiffuseMaterial x:Key="RingMaterial" Brush="LightGray"/>
        <ContainerUIElement3D x:Key="Ring" x:Shared="False">
            <ContainerUIElement3D.Transform>
                <RotateTransform3D>
                    <RotateTransform3D.Rotation>
                        <AxisAngleRotation3D Axis="0,1,0" Angle="10"/>
                    </RotateTransform3D.Rotation>
                </RotateTransform3D>
            </ContainerUIElement3D.Transform>
            <p:Ring3D 
                Material="{StaticResource RingMaterial}"
                SideCount="{StaticResource RingSideCount}"
                SegmentCount="{StaticResource RingSegmentCount}"
                Radius="{StaticResource RingRadius}">
                <p:Ring3D.Transform>
                    <Transform3DGroup>
                        <StaticResource ResourceKey="RingScaleTransform"/>
                    </Transform3DGroup>
                </p:Ring3D.Transform>
            </p:Ring3D>
            <p:Conical3D 
                Material="{StaticResource RingMaterial}"
                SideCount="{StaticResource RingSideCount}">
                <p:Conical3D.Transform>
                    <Transform3DGroup>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="0,1,0" Angle="180"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                        <StaticResource ResourceKey="ConicalScaleTransform"/>
                        <TranslateTransform3D OffsetX="1.0" />
                    </Transform3DGroup>
                </p:Conical3D.Transform>
            </p:Conical3D>
            <p:Conical3D 
                Material="{StaticResource RingMaterial}"
                SideCount="{StaticResource RingSideCount}">
                <p:Conical3D.Transform>
                    <Transform3DGroup>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="0,1,0" Angle="180"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                        <StaticResource ResourceKey="ConicalScaleTransform"/>
                        <TranslateTransform3D OffsetX="1.0" />
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="0,1,0" Angle="180"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </Transform3DGroup>
                </p:Conical3D.Transform>
            </p:Conical3D>
        </ContainerUIElement3D>
    </Page.Resources>
    <TabControl Style="{StaticResource SkinedTabControl}">
        <TabItem 
            Header="Right-handed">
            <p:Workshop3D>
                <p:XyzAxis3D 
                    Length="2.0"/>
                <StaticResource ResourceKey="Ring"/>
            </p:Workshop3D>
        </TabItem>
        <TabItem 
            Header="Left-handed">
            <p:Workshop3D>
                <p:XyzAxis3D 
                    Length="2.0"
                    CoordinateSystemKind="LeftHanded"/>
                <ContainerUIElement3D>
                    <ContainerUIElement3D.Transform>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="0,0,1" Angle="180"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </ContainerUIElement3D.Transform>
                    <StaticResource ResourceKey="Ring"/>
                </ContainerUIElement3D>
            </p:Workshop3D>
        </TabItem>
        <TabItem 
            Header="Rotation X">
            <p:Workshop3D
                Name="xWorkshop">
                <p:XyzAxis3D Length="2.0"/>
                <ContainerUIElement3D>
                    <ContainerUIElement3D.Transform>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="0,0,1" Angle="-90"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </ContainerUIElement3D.Transform>
                    <StaticResource ResourceKey="Ring"/>
                </ContainerUIElement3D>
            </p:Workshop3D>
        </TabItem>        
        <TabItem 
            Header="Rotation Y">
            <p:Workshop3D
                Name="yWorkshop">
                <p:XyzAxis3D Length="2.0"/>
                <StaticResource ResourceKey="Ring"/>
            </p:Workshop3D>
        </TabItem>
        <TabItem 
            Header="Rotation Z">
            <p:Workshop3D
                Name="zWorkshop">
                <p:XyzAxis3D Length="2.0"/>
                <ContainerUIElement3D>
                    <ContainerUIElement3D.Transform>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="1,0,0" Angle="90"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </ContainerUIElement3D.Transform>
                    <StaticResource ResourceKey="Ring"/>
                </ContainerUIElement3D>
            </p:Workshop3D>
        </TabItem>
        <TabItem Header="Multiplication">
            <p:Workshop3D>
                <p:XyzAxis3D Length="2.0"/>
                <p:Box3D x:Name="box" />
            </p:Workshop3D>
        </TabItem>
    </TabControl>
</Page>
